﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DevExpress.Web.ASPxEditors;
using TONLI.TJOA.Domain;
using System.Collections.Generic;
using TONLI.TJOA.Common;
namespace TONLI.TJOA.Anquan
{
    public partial class FileMng : System.Web.UI.Page
    {
        string dwid = "";
        protected void Page_Load(object sender, EventArgs e)
        {
          
            AjaxPro.Utility.RegisterTypeForAjax(typeof(FileMng));
            Session["dwid"]=dwid = Request["dwid"];
        }

        protected void ASPxGridView1_StartRowEditing(object sender, DevExpress.Web.Data.ASPxStartRowEditingEventArgs e)
        {
            ASPxGridView1.DoRowValidation();
        }

        protected void ASPxGridView1_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            e.Cancel = true;
            string a = e.Keys["UID"].ToString();
            Session["obj_id"] = e.Keys["UID"].ToString();
            ObjectDataSource1.Delete();

        }
     

        protected void ASPxGridView1_HtmlRowCreated1(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableRowEventArgs e)
        {
            //ASPxHyperLink Link1 = ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, null, "ASPxHyperLink1") as ASPxHyperLink;
            //Link1.NavigateUrl = string.Format("javascript:ShowDetail('{0}');", Server.UrlEncode(ASPxGridView1.GetRowValues(e.VisibleIndex, "FilePath").ToString()));
            ASPxHyperLink Link2 = ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, null, "ASPxHyperLink2") as ASPxHyperLink;
            Link2.NavigateUrl = string.Format("javascript:ShowDetail2('{0}');", Server.UrlEncode(ASPxGridView1.GetRowValues(e.VisibleIndex, "FilePath").ToString()));
        }

        protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            Response.Redirect("AddFile.aspx?dwid="+dwid);
        }

        public IList<TJOA_FileInfo> GetListMng()
        {

            IList<TJOA_FileInfo> list;

            TJOA_FileInfo q = new TJOA_FileInfo();

            q.Col1 = " col1='" + Session["dwid"].ToString() + "' ";
            list = DataService.BaseService().GetList<TJOA_FileInfo>("SelectTJOA_FileInfoList", q);

            return list;
        }
        public void Delete(string obj_id)
        {
            TJOA_FileInfo f = new TJOA_FileInfo();
            f.UID = obj_id;
            DataService.BaseService().Update("DeleteTJOA_FileInfo", f);
        }
      
    }
}
